package com.xmlasia.remote.service;

import java.io.File;
import java.util.Date;
import java.util.zip.Adler32;
import java.util.zip.Checksum;

import org.apache.commons.io.FileUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class DefaultService {

	private Logger logger = LoggerFactory.getLogger(DefaultService.class);
	
	public void process(byte[] fileByte) throws Exception{
		logger.info("-----");
		Checksum checksum = new Adler32();
		checksum.update(fileByte, 0, fileByte.length);
		long checksumValue = checksum.getValue();
		logger.info("CheckSum : " + checksumValue);
		String fileName = new StringBuffer().append("C:/XML/Receive/").append(new Date().getTime()).append(".jar").toString();
		FileUtils.writeByteArrayToFile(new File(fileName), fileByte);
	}
}
